package com.childenglish.controller;

import com.childenglish.utils.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {

    @GetMapping("/")
    public R home() {
        Map<String, Object> data = new HashMap<>();
        data.put("app", "少儿英语辅助学习平台");
        data.put("version", "2.0.0");
        data.put("status", "服务运行正常");
        data.put("timestamp", new Date());
        data.put("apis", new String[]{
                "POST /login - 用户登录",
                "GET /learning/listening - 磨耳朵功能",
                "GET /learning/game/levels - 游戏关卡",
                "GET /parent/child/learning - 家长查看孩子学习"
        });
        return R.ok("欢迎使用少儿英语平台").data(data);
    }

    @GetMapping("/test")
    public R test() {
        return R.ok("服务测试正常");
    }

    @GetMapping("/health")
    public R health() {
        return R.ok("服务健康状态正常");
    }
}